#ifndef __Thread_H__
#define __Thread_H__

#include "Noncopyable.h"
#include <stdio.h>
#include <pthread.h>

#include <functional>

namespace wd
{
using ThreadCallback=std::function<void()>;

//在语义上的表达会更明确一些
class Thread : Noncopyable
{
public:
    //public区域的成员是该类对外提供的接口/功能/服务
    Thread(ThreadCallback && cb);
    ~Thread() 
    {
        printf("~Thread()\n");
    }

    void start();
    void join();

private:
    static void * start_routine(void*);

//数据成员放在类中靠下的位置
protected:

private:
    pthread_t       _pthid;
    bool            _isRunning;
    ThreadCallback  _cb;
};


}//end of namespace wd


#endif

